import requests

server_url = 'http://0.0.0.0:8090/core/district/'


def test_add_district():
    data = {'name': 'cui6', 'code':16, 'lat':3, 'lng':2, 'dis_order':1,
            'description': 'ddd', 'status':1, 'parent_id':1,
            'item':[{'lng':11.2, 'lat':3.6,'dis_order':2},{'lng':11.5, 'lat':3.2,'dis_order':5}]}
    url = server_url + 'add/'
    headers = {'Content-Type': 'application/json'}
    r = requests.post(url, json=data, headers=headers)
    print(r.json())

def get_tree_all():
    # data = {'name': 'cui6', }
    url = server_url + 'get_tree_all/'
    headers = {'Content-Type': 'application/json'}
    r = requests.get(url, headers=headers)
    print(r.json())

def test_del_district():
    data = {'id':12}
    url = server_url + 'del/'
    headers = {'Content-Type': 'application/json'}
    r = requests.post(url, json=data, headers=headers)
    print(r.json())

def test_search_device_type():
    data = {'query_word':'测试'}
    url = server_url + 'search/'
    headers = {'Content-Type': 'application/json'}
    r = requests.post(url, json=data, headers=headers)
    print(r.json())

get_tree_all()
# test_add_district()
# test_del_district()
# test_search_device_type()

if __name__ == '__main__':
    pass